﻿// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Windows;

namespace OnlineBookReader
{
    /// <summary>
    /// The SampleAttribute identifies sample name and level of difficulty.
    /// </summary>
    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]    
    public sealed class SampleAttribute : ExportAttribute, ISampleMetadata
    {
        /// <summary>
        /// Gets the path to the sample in the Sample Browser tree.
        /// </summary>
        public string Name { get; private set; }
        public string ViewName { get; private set; }
      
       /// <summary>
       /// 一直以Sample为名称，FrameworkElement为contract类型建立part。其他参数都是附加信息
       /// </summary>
       /// <param name="name"></param>
       /// <param name="linkPath"></param>
        public SampleAttribute(string name,string linkPath)
            : base("Sample", typeof(FrameworkElement))
        {
            Debug.Assert(!string.IsNullOrEmpty(name), "name should not be empty!");
            Name = name;
            ViewName = linkPath;
         
        }
    }
}